﻿using System;
using System.Drawing;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using StedySoft.SenseSDK;

namespace SenseTimeTracker.Users
{
	public class UserDisplayItem : CommonSenseControls.CommonSenseDisplayPanelItem
	{
		private Guid userId = Guid.Empty;
		private string userName = string.Empty;

		public UserDisplayItem()
		{
			Height = 50;
		}

		public Guid UserId
		{
			get { return userId; }
			set { userId = value; }
		}

		public string UserName
		{
			get { return userName; }
			set { userName = value; }
		}

		#region ISenseListItem Members
		public override void OnRender(Graphics g)
		{
			using (Brush brush = new SolidBrush(Color.Black))
			using (Brush selecteionBrush = new SolidBrush(Color.Gray))
			using (Font font = new Font("Helvetica Neue OTS", 9f, FontStyle.Regular))
			{
				if (selected)
				{
					g.FillRectangle(selecteionBrush, ClientRectangle);
				}
				SizeF textSize = g.MeasureString(userName, font);
				g.DrawString(userName, font, brush, ClientRectangle.Left + 8, ClientRectangle.Top + (ClientRectangle.Height - textSize.Height) / 2);
			}

			base.OnRender(g);
		}
		#endregion
	}
}
